package com.tree;

public class LeafCounter {

	public int count (TreeNode root)
	{
		if (root == null){
			return 0;
		}
		
		//if the node hasn't child will be leaf.
		if (root.left == null && root.right == null)
		{
			return 1;
		}
		
		return (this.count(root.left) + this.count(root.right));
	}
	
}
